home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_apache.idb / usr / freeware / catman / a_man / cat8 / apxs.Z / apxs
Encoding:
Text File  |  1999-07-16  |  13.1 KB  |  331 lines

  1.  
  2.  
  3.  
  4.      aaaappppxxxxssss((((8888))))        UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((AAAApppprrrriiiillll 1111999999998888))))           aaaappppxxxxssss((((8888))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       apxs - APache    eXtenSion tool
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.       aaaappppxxxxssss ----gggg ----nnnn _m_o_d_n_a_m_e
  13.  
  14.       aaaappppxxxxssss ----qqqq _q_u_e_r_y    ...
  15.  
  16.       aaaappppxxxxssss ----cccc [ ----oooo _d_s_o_f_i_l_e ] [ ----IIII _i_n_c_d_i_r ] [ ----DDDD _n_a_m_e=_v_a_l_u_e ] [ ----LLLL
  17.       _l_i_b_d_i_r ] [ ----llll    _l_i_b_n_a_m_e    ] [ ----WWWWcccc,,,,_c_o_m_p_i_l_e_r-_f_l_a_g_s ] [
  18.       ----WWWWllll,,,,_l_i_n_k_e_r-_f_l_a_g_s ] _f_i_l_e_s ...
  19.  
  20.       aaaappppxxxxssss ----iiii [ ----nnnn _m_o_d_n_a_m_e ] [ ----aaaa ]    [ ----AAAA ] _d_s_o_f_i_l_e ...
  21.  
  22.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  23.       aaaappppxxxxssss is a tool for building and installing extension modules
  24.       for the Apache HyperText Transfer Protocol (HTTP) server.
  25.       This is achieved by building a dynamic shared    object (DSO)
  26.       from one or more source or object _f_i_l_e_s which    then can be
  27.       loaded into the Apache server    under runtime via the
  28.       LLLLooooaaaaddddMMMMoooodddduuuulllleeee directive from mmmmoooodddd____ssssoooo....
  29.  
  30.       So to    use this extension mechanism your platform has to
  31.       support the DSO feature and your Apache hhhhttttttttppppdddd    binary has to
  32.       be built with    the mmmmoooodddd____ssssoooo module.  The    aaaappppxxxxssss tool
  33.       automatically    complains if this is not the case.  You    can
  34.       check    this yourself by manually running the command
  35.  
  36.         $ httpd -l
  37.  
  38.       The module mmmmoooodddd____ssssoooo should be part of the displayed list.  If
  39.       these    requirements are fulfilled you can easily extend your
  40.       Apache server's functionality    by installing your own modules
  41.       with the DSO mechanism by the    help of    this aaaappppxxxxssss tool:
  42.  
  43.         $ apxs -i -a -c mod_foo.c
  44.         gcc    -fpic -DSHARED_MODULE -I/path/to/apache/include    -c mod_foo.c
  45.         ld -Bshareable -o mod_foo.so mod_foo.o
  46.         cp mod_foo.so /path/to/apache/libexec/mod_foo.so
  47.         chmod 755 /path/to/apache/libexec/mod_foo.so
  48.         [activating    module `foo' in    /path/to/apache/etc/httpd.conf]
  49.         $ apachectl    restart
  50.         /path/to/apache/sbin/apachectl restart: httpd not running, trying to start
  51.         [Tue Mar 31    11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module
  52.         /path/to/apache/sbin/apachectl restart: httpd started
  53.         $ _
  54.  
  55.       The arguments    _f_i_l_e_s can be any C source file (.c), a object
  56.       file (.o) or even a library archive (.a). The    aaaappppxxxxssss tool
  57.       automatically    recognizes these extensions and    automtaically
  58.       used the C source files for compilation while    just using the
  59.       object and archive files for the linking phase. But when
  60.  
  61.  
  62.  
  63.      Page 1                          (printed 5/3/99)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      aaaappppxxxxssss((((8888))))        UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((AAAApppprrrriiiillll 1111999999998888))))           aaaappppxxxxssss((((8888))))
  71.  
  72.  
  73.  
  74.       using    such pre-compiled objects make sure they are compiled
  75.       for position independend code    (PIC) to be able to use    them
  76.       for a    dynamically loaded shared object.  For instance    with
  77.       GCC you always just have to use ----ffffppppiiiicccc.  For other C
  78.       compilers consult its    manual page or at watch    for the    flags
  79.       aaaappppxxxxssss uses to compile the object files.
  80.  
  81.       For more details about DSO support in    Apache read the
  82.       documentation    of mmmmoooodddd____ssssoooo or perhaps even read the
  83.       ssssrrrrcccc////mmmmoooodddduuuulllleeeessss////ssssttttaaaannnnddddaaaarrrrdddd////mmmmoooodddd____ssssoooo....cccc    source file.
  84.  
  85.  
  86.      OOOOPPPPTTTTIIIIOOOONNNNSSSS
  87.       Common options:
  88.  
  89.       ----nnnn _m_o_d_n_a_m_e  This explicitly sets the module name for the ----iiii
  90.               (install)    and ----gggg (template generation) option.
  91.               Use this to explicitly specify the module    name.
  92.               For option ----gggg this is required, for option ----iiii
  93.               the aaaappppxxxxssss tool tries to determine the name    from
  94.               the source or (as    a fallback) at least by
  95.               guessing it from the filename.
  96.  
  97.       Query    options:
  98.  
  99.       ----qqqq          Performs a query for aaaappppxxxxssss's knowledge about
  100.               certain settings.    The _q_u_e_r_y parameters can be
  101.               one or more of the following strings:
  102.             CC        TARGET
  103.             CFLAGS        SBINDIR
  104.             CFLAGS_SHLIB    INCLUDEDIR
  105.             LD_SHLIB    LIBEXECDIR
  106.             LDFLAGS_SHLIB    SYSCONFDIR
  107.             LIBS_SHLIB
  108.               Use this for manually determining    settings. For
  109.               instance use
  110.             INC=-I`apxs -q INCLUDEDIR`
  111.               inside your own Makefiles    if you need manual
  112.               access to    Apache's C header files.
  113.  
  114.       Template Generation options:
  115.  
  116.       ----gggg          This generates a subdirectory _n_a_m_e (see option
  117.               ----nnnn) and there two    files: A sample    module source
  118.               file named mmmmoooodddd_____n_a_m_e._c which can be used as a
  119.               template for creating your own modules or    as a
  120.               quick start for playing with the APXS mechanism.
  121.               And a corresponding MMMMaaaakkkkeeeeffffiiiilllleeee for even easier
  122.               build and    installing of this module.
  123.  
  124.       DSO compilation options:
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                          (printed 5/3/99)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      aaaappppxxxxssss((((8888))))        UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((AAAApppprrrriiiillll 1111999999998888))))           aaaappppxxxxssss((((8888))))
  137.  
  138.  
  139.  
  140.       ----cccc          This indicates the compilation operation.    It
  141.               first compiles the C source files    (.c) of    _f_i_l_e_s
  142.               into corresponding object    files (.o) and then
  143.               builds a dynamically shared object in _d_s_o_f_i_l_e by
  144.               linking these object files plus the remaining
  145.               object files (.o and .a) of _f_i_l_e_s    If no ----oooo
  146.               option is    specified the output file is guessed
  147.               from the first filename in _f_i_l_e_s and thus
  148.               usually defaults to mmmmoooodddd_____n_a_m_e._s_o
  149.  
  150.       ----oooo _d_s_o_f_i_l_e  Explicitly specifies the filename    of the created
  151.               dynamically shared object. If not    specified and
  152.               the name cannot be guessed from the _f_i_l_e_s    list,
  153.               the fallback name    mmmmoooodddd____uuuunnnnkkkknnnnoooowwwwnnnn....ssssoooo is used.
  154.  
  155.       ----DDDD _n_a_m_e=_v_a_l_u_e
  156.               This option is directly passed through to    the
  157.               compilation command(s).  Use this    to add your
  158.               own defines to the build process.
  159.  
  160.       ----IIII _i_n_c_d_i_r   This option is directly passed through to    the
  161.               compilation command(s).  Use this    to add your
  162.               own include directories to search    to the build
  163.               process.
  164.  
  165.       ----LLLL _l_i_b_d_i_r   This option is directly passed through to    the
  166.               linker command.  Use this    to add your own
  167.               library directories to search to the build
  168.               process.
  169.  
  170.       ----llll _l_i_b_n_a_m_e  This option is directly passed through to    the
  171.               linker command.  Use this    to add your own
  172.               libraries    to search to the build process.
  173.  
  174.       ----WWWWcccc,,,,_c_o_m_p_i_l_e_r-_f_l_a_g_s
  175.               This option passes _c_o_m_p_i_l_e_r-_f_l_a_g_s    as additional
  176.               flags to the compiler command.  Use this to add
  177.               local compiler-specific options.
  178.  
  179.       ----WWWWllll,,,,_l_i_n_k_e_r-_f_l_a_g_s
  180.               This option passes _l_i_n_k_e_r-_f_l_a_g_s as additional
  181.               flags to the linker command.  Use    this to    add
  182.               local linker-specific options.
  183.  
  184.       DSO installation options:
  185.  
  186.       ----iiii          This indicates the installation operartion and
  187.               installs one or more dynamically shared objects
  188.               into the servers _l_i_b_e_x_e_c directory.
  189.  
  190.       ----aaaa          This additionally    activates the module by
  191.               automatically adding a corresponding LLLLooooaaaaddddMMMMoooodddduuuulllleeee
  192.  
  193.  
  194.  
  195.      Page 3                          (printed 5/3/99)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      aaaappppxxxxssss((((8888))))        UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((AAAApppprrrriiiillll 1111999999998888))))           aaaappppxxxxssss((((8888))))
  203.  
  204.  
  205.  
  206.               line to Apache's hhhhttttttttppppdddd....ccccoooonnnnffff configuration    file
  207.               (only if still no    such entry exists).
  208.  
  209.       ----AAAA          Same as option ----aaaa    but the    created    LLLLooooaaaaddddMMMMoooodddduuuulllleeee
  210.               directive    is prefixed with a hash    sign (#), i.e.
  211.               the module is just prepared for later activation
  212.               but initially disabled.
  213.  
  214.      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  215.       Assume you have an Apache module named mod_foo.c available
  216.       which    should extend Apache's server functionality. To
  217.       accomplish this you first have to compile the    C source into
  218.       a shared object suitable for loading into the    Apache server
  219.       under    runtime    via the    following command:
  220.  
  221.         $ apxs -c mod_foo.c
  222.         gcc    -fpic -DSHARED_MODULE -I/path/to/apache/include    -c mod_foo.c
  223.         ld -Bshareable -o mod_foo.so mod_foo.o
  224.         $ _
  225.  
  226.       Then you have    to update the Apache configuration by making
  227.       sure a LLLLooooaaaaddddMMMMoooodddduuuulllleeee directive is present to load this shared
  228.       object. To simplify this step    aaaappppxxxxssss provides an automatic way
  229.       to install the shared    object in its "libexec"    directory and
  230.       updating the hhhhttttttttppppdddd....ccccoooonnnnffff file accordingly. This can be
  231.       achieved by running:
  232.  
  233.         $ apxs -i -a mod_foo.c
  234.         cp mod_foo.so /path/to/apache/libexec/mod_foo.so
  235.         chmod 755 /path/to/apache/libexec/mod_foo.so
  236.         [activating    module `foo' in    /path/to/apache/etc/httpd.conf]
  237.         $ _
  238.  
  239.       This way a line named
  240.  
  241.         LoadModule foo_module libexec/mod_foo.so
  242.  
  243.       is added to the configuration    file if    still not present.  If
  244.       you want to have this    this disabled per default use the ----AAAA
  245.       option, i.e.
  246.  
  247.         $ apxs -i -A mod_foo.c
  248.  
  249.       For a    quick test of the APXS mechanism you can create    a
  250.       sample Apache    module template    plus a corresponding Makefile
  251.       via:
  252.  
  253.         $ apxs -g -n foo
  254.         Creating [DIR]  foo
  255.         Creating [FILE] foo/Makefile
  256.         Creating [FILE] foo/mod_foo.c
  257.         $ _
  258.  
  259.  
  260.  
  261.      Page 4                          (printed 5/3/99)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      aaaappppxxxxssss((((8888))))        UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((AAAApppprrrriiiillll 1111999999998888))))           aaaappppxxxxssss((((8888))))
  269.  
  270.  
  271.  
  272.       Then you can immediately compile this    sample module into a
  273.       shared object    and load it into the Apache server:
  274.  
  275.         $ cd foo
  276.         $ make all reload
  277.         apxs -c mod_foo.c
  278.         gcc    -fpic -DSHARED_MODULE -I/path/to/apache/include    -c mod_foo.c
  279.         ld -Bshareable -o mod_foo.so mod_foo.o
  280.         apxs -i -a -n "foo"    mod_foo.so
  281.         cp mod_foo.so /path/to/apache/libexec/mod_foo.so
  282.         chmod 755 /path/to/apache/libexec/mod_foo.so
  283.         [activating    module `foo' in    /path/to/apache/etc/httpd.conf]
  284.         apachectl restart
  285.         /path/to/apache/sbin/apachectl restart: httpd not running, trying to start
  286.         [Tue Mar 31    11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module
  287.         /path/to/apache/sbin/apachectl restart: httpd started
  288.         $ _
  289.  
  290.       You can even use aaaappppxxxxssss    to compile complex modules outside the
  291.       Apache source    tree, like PHP3:
  292.  
  293.         $ cd php3
  294.         $ ./configure --with-shared-apache=../apache-1.3
  295.         $ apxs -c -o libphp3.so mod_php3.c libmodphp3-so.a
  296.         gcc    -fpic -DSHARED_MODULE -I/tmp/apache/include  -c    mod_php3.c
  297.         ld -Bshareable -o libphp3.so mod_php3.o libmodphp3-so.a
  298.         $ _
  299.  
  300.       because aaaappppxxxxssss automatically recognized    C source files and
  301.       object files.     Only C    source files are compiled while
  302.       remaining object files are used for the linking phase.
  303.  
  304.  
  305.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  306.       aaaappppaaaacccchhhheeeeccccttttllll((((1111)))),,,,    hhhhttttttttppppdddd((((8888))))....
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.      Page 5                          (printed 5/3/99)
  328.  
  329.  
  330.  
  331.